<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>PaperScope</title>
<base target="class-frame">
<link href="../assets/css/docs.css" rel="stylesheet" type="text/css">
<script src="../assets/js/paper.js"></script>
<script src="../assets/js/jquery.js"></script>
<script src="../assets/js/codemirror.js"></script>
<script src="../assets/js/docs.js"></script>
</head>
<body class="reference">
<div class="reference-class">
<h1>PaperScope</h1>

<p>The <tt>PaperScope</tt> class represents the scope associated with a
Paper context. When working with PaperScript, these scopes are automatically
created for us, and through clever scoping the properties and methods of the
active scope seem to become part of the global scope.</p>
<p>When working with normal JavaScript code, <tt>PaperScope</tt> objects need to
be manually created and handled.</p>
<p>Paper classes can only be accessed through <tt>PaperScope</tt> objects. Thus
in PaperScript they are global, while in JavaScript, they are available on
the global <a href="../classes/global.html#paper"><tt>paper</tt></a> object. For JavaScript you can use
<a href="../classes/PaperScope.html#install-scope"><tt>paperScope.install(scope)</tt></a> to install the Paper classes and objects
on the global scope. Note that when working with more than one scope, this
still works for classes, but not for objects like <a href="../classes/PaperScope.html#project"><tt>paperScope.project</tt></a>,
since they are not updated in the injected scope if scopes are switched.</p>
<p>The global <a href="../classes/global.html#paper"><tt>paper</tt></a> object is simply a reference to the currently active
<tt>PaperScope</tt>.</p>

</div>

<!-- ============================== constructors ========================= -->
<div class="reference-members"><h2>Constructors</h2>
	
		
<div id="paperscope" class="member">
<div class="member-link">
<a name="paperscope" href="#paperscope"><tt><b>PaperScope</b>()</tt></a>
</div>
<div class="member-description hidden">
<div class="member-text">
<p>Creates a PaperScope object.</p>




</div>
</div>
</div>
	
</div>





	<div class="reference-members"><h2>Properties</h2>
		
			
<div id="version" class="member">
<div class="member-link">
<a name="version" href="#version"><tt><b>version</b></tt></a>
</div>
<div class="member-description hidden">

<div class="member-text">
	<p>The version of Paper.js, as a string.</p>
	
	
	<ul><b>Type:</b>
	<li>
		<tt>String</tt>
	</li>
	</ul>
	
	
</div>

</div>
</div>
		
			
<div id="settings" class="member">
<div class="member-link">
<a name="settings" href="#settings"><tt><b>settings</b></tt></a>
</div>
<div class="member-description hidden">

<div class="member-text">
	<p>Gives access to paper's configurable settings.</p>
<p><b>settings.applyMatrix:</b></p>
<p><b>settings.handleSize:</b></p>
<p><b>settings.hitTolerance:</b></p>
	
	
	<ul><b>Type:</b>
	<li>
		<tt>Object</tt>
	</li>
	</ul>
	
	
</div>

</div>
</div>
		
			
<div id="project" class="member">
<div class="member-link">
<a name="project" href="#project"><tt><b>project</b></tt></a>
</div>
<div class="member-description hidden">

<div class="member-text">
	<p>The currently active project.</p>
	
	
	<ul><b>Type:</b>
	<li>
		<a href="../classes/Project.html"><tt>Project</tt></a>
	</li>
	</ul>
	
	
</div>

</div>
</div>
		
			
<div id="projects" class="member">
<div class="member-link">
<a name="projects" href="#projects"><tt><b>projects</b></tt></a>
</div>
<div class="member-description hidden">

<div class="member-text">
	<p>The list of all open projects within the current Paper.js context.</p>
	
	
	<ul><b>Type:</b>
	<li>
		Array of <a href="../classes/Project.html"><tt>Project</tt></a> objects
	</li>
	</ul>
	
	
</div>

</div>
</div>
		
			
<div id="view" class="member">
<div class="member-link">
<a name="view" href="#view"><tt><b>view</b></tt></a>
</div>
<div class="member-description hidden">

<div class="member-text">
	<p>The reference to the active project's view.</p>
	
		<p>Read only.</p>
	
	
	<ul><b>Type:</b>
	<li>
		<a href="../classes/View.html"><tt>View</tt></a>
	</li>
	</ul>
	
	
</div>

</div>
</div>
		
			
<div id="tool" class="member">
<div class="member-link">
<a name="tool" href="#tool"><tt><b>tool</b></tt></a>
</div>
<div class="member-description hidden">

<div class="member-text">
	<p>The reference to the active tool.</p>
	
	
	<ul><b>Type:</b>
	<li>
		<a href="../classes/Tool.html"><tt>Tool</tt></a>
	</li>
	</ul>
	
	
</div>

</div>
</div>
		
			
<div id="tools" class="member">
<div class="member-link">
<a name="tools" href="#tools"><tt><b>tools</b></tt></a>
</div>
<div class="member-description hidden">

<div class="member-text">
	<p>The list of available tools.</p>
	
	
	<ul><b>Type:</b>
	<li>
		Array of <a href="../classes/Tool.html"><tt>Tool</tt></a> objects
	</li>
	</ul>
	
	
</div>

</div>
</div>
		
	</div>



<!-- ============================== methods ================================ -->
	<div class="reference-members"><h2>Methods</h2>
		
			
<div id="install-scope" class="member">
<div class="member-link">
<a name="install-scope" href="#install-scope"><tt><b>install</b>(scope)</tt></a>
</div>
<div class="member-description hidden">
<div class="member-text">
	<p>Injects the paper scope into any other given scope. Can be used for
examle to inject the currently active PaperScope into the window's global
scope, to emulate PaperScript-style globally accessible Paper classes and
objects.</p>
<p><b>Please note:</b> Using this method may override native constructors
(e.g. Path, RGBColor). This may cause problems when using Paper.js in
conjunction with other libraries that rely on these constructors. Keep
the library scoped if you encounter issues caused by this.</p>
	
<ul><b>Parameters:</b>

<li>
<tt>scope:</tt> 



</li>

</ul>

	
	
	<p>
<b>Example</b> 
</p>


<pre class="code">paper.install(window);</pre>

</div>
</div>
</div>
		
			
<div id="setup-element" class="member">
<div class="member-link">
<a name="setup-element" href="#setup-element"><tt><b>setup</b>(element)</tt></a>
</div>
<div class="member-description hidden">
<div class="member-text">
	<p>Sets up an empty project for us. If a canvas is provided, it also creates
a <a href="../classes/View.html"><tt>View</tt></a> for it, both linked to this scope.</p>
	
<ul><b>Parameters:</b>

<li>
<tt>element:</tt> 
<tt>HTMLCanvasElement</tt> / <tt>String</tt>
&mdash;&nbsp;the HTML canvas element this
scope should be associated with, or an ID string by which to find the
element.

</li>

</ul>

	
	
	
</div>
</div>
</div>
		
			
<div id="activate" class="member">
<div class="member-link">
<a name="activate" href="#activate"><tt><b>activate</b>()</tt></a>
</div>
<div class="member-description hidden">
<div class="member-text">
	<p>Activates this PaperScope, so all newly created items will be placed
in its active project.</p>
	
	
	
	
</div>
</div>
</div>
		
	</div>


	<div class="reference-members"><h2>Static Methods</h2>
		
			
<div id="get-id" class="member">
<div class="member-link">
<a name="get-id" href="#get-id"><tt><b>PaperScope.get</b>(id)</tt></a>
</div>
<div class="member-description hidden">
<div class="member-text">
	<p>Retrieves a PaperScope object with the given scope id.</p>
	
<ul><b>Parameters:</b>

<li>
<tt>id:</tt> 



</li>

</ul>

	
	
	
</div>
</div>
</div>
		
	</div>



<!-- =========================== copyright notice ========================= -->
<p class="footer">Copyright &#169; 2011 <a href="http://www.lehni.org" target="_blank">J&uuml;rg Lehni</a> &amp; <a href="http://www.jonathanpuckey.com" target="_blank">Jonathan Puckey</a>. All Rights Reserved.</p>
<div class="content-end"></div>

</body>